package interfaceCusService;


import interfaceWorker.*;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

public class CusServiceGui extends JPanel implements ActionListener {
	
	private CusServiceFrame scf;
	private JButton btnansw,btnsavep;
	private Dimension df;
	
	private SetupPanel sp;
	
	public CusServiceGui(Dimension fs,CusServiceFrame sf){
		scf=sf;
		df=fs;
		scf.setname("Custome Service Station");
		this.setSize(fs);
		this.setLayout(null);
		
		btnansw = new JButton("Answer Complaint");
		btnansw.setBounds(150, 60, 150, 25);
		this.add(btnansw);
		btnansw.addActionListener(this);
		
		btnsavep= new JButton("Reserve Spot");
		btnsavep.setBounds(150, 100, 115, 25);
		this.add(btnsavep);
		btnsavep.addActionListener(this);
		
		
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
		if(e.getSource() == btnsavep) {
			sp=new SetupPanel();
			sp = new SetupPanel();
			if(sp.getrawsize()==0)
				JOptionPane.showMessageDialog(this,"You Require to Setup the lot first","OK",JOptionPane.ERROR_MESSAGE);
			else
			{
			removeAll();
	        add(new ReserveParkingSpotCSPanel(df,scf));
	        validate();
	        repaint();
			scf.setname("Reserve Parking Spot");
			}
		}
		
		if(e.getSource() == btnansw)
		{
			removeAll();
	        add(new ComplaintTable(df,scf));
	        //validate();
	        repaint();
			scf.setname("Answer Complaint");
		}
		
	}

}
